import { ArrayMinSize, IsArray, IsBoolean, IsEmpty, IsNotEmpty, IsNumber, IsOptional, IsString, Max, MaxLength, Min } from "class-validator";

class CommonDto {
    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    name:string;


    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    @IsOptional()
    path:string;

    @MaxLength(50)
    @IsString()
    @IsOptional()
    component:string;

    @MaxLength(100)
    @IsString()
    @IsOptional()
    permission:string;

    @MaxLength(100)
    @IsString()
    @IsOptional()
    api:string;

    @IsString()
    @IsOptional()
    apiMethod: 'GET' | 'POST' | 'PUT' | 'DELETE';

    @IsBoolean({})
    @IsOptional()
    keepAlive:boolean;

    @Min(0)
    @IsNumber({})
    @IsOptional()
    sort:number;

    @IsBoolean({})
    @IsOptional()
    display:boolean;

    @IsBoolean({})
    @IsOptional()
    enable:boolean;

    
}

export class AddDto extends CommonDto {
    @Min(0)
    @IsNumber({})
    parentId:number;

    @MaxLength(30)
    @IsNotEmpty()
    @IsString()
    @IsOptional()
    type:'FOLD' | 'PAGE' | 'BUTTON';
}

export class EditDto extends CommonDto {
    
}